package com.yuncheng.oaApi.busService;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yuncheng.exception.BusinessException;

import com.yuncheng.oaApi.constant.OaCommonFlowConstant;
import com.yuncheng.oaApi.constant.OaFlowConstant;
import com.yuncheng.oaApi.entity.*;
import com.yuncheng.oaApi.service.*;

import com.yuncheng.oaApi.utils.GetUuIdUtils;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import utils.DateConversionUtils;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;

@Component(value = "YssbService")
public class YssbService {
    private static final Logger log = LoggerFactory.getLogger(YssbService.class);



    @Resource
    @Lazy
    private INkBmysxmsbsplcService nbmysxmsbsplcService;

    @Resource
    @Lazy
    private INkYssbhjService nkYssbhjService;

    @Resource
    @Lazy
    private INkRsBmysxmsbService nkyrsBmysxmsbService;


    @Resource
    @Lazy
    private INkBmysxmsbXmnrService nkBmysxmsbXmnrService;

    @Resource
    @Lazy
    private IOaProcessBusinessService oaProcessBusinessService;


    @Resource
    @Lazy
    private IOaSpcySqsxJobService oaSpcySqsxJobService;

    @Resource
    @Lazy
    private INkYssbhjKtService nkYssbhjKtService;

    @Resource
    @Lazy
    private INkYssbhjysService nkYssbhjysService;

    @Resource
    @Lazy
    private INkYssbhjPxService nkYssbhjpxService;

    @Resource
    @Lazy
    private INkYssbhjjxzbService nkYssbhjjxzbService;

    @Resource
    @Lazy
    private INkRsNdService nkRsNdService;


    public List hzbd(String flx, String bm) {

        List<NkRsnd> nkRsnds = nkRsNdService.list(new LambdaQueryWrapper<NkRsnd>()
                .eq(NkRsnd::getFsfxz, OaCommonFlowConstant.NDXZ_YES));

        int ndi = Integer.valueOf(nkRsnds.get(0).getFnd()) + 1;
        //如果本年度的计划为空，新建计划.然后更新

        String nd = String.valueOf(ndi);


        String jhid = "";
        List<NkBmysxmsbsplc> nkBmysxmsbsplcs = nbmysxmsbsplcService.list(new LambdaQueryWrapper<NkBmysxmsbsplc>()
                .eq(NkBmysxmsbsplc::getFnd, nd));
//        if (CollectionUtils.isEmpty(nkBmysxmsbsplcs)) {
//            //先新建一个计划，然后根据年度将部门预算申报计划的计划id字段赋值
//            NkBmysxmsbsplc nkBmysxmsbsplc = new NkBmysxmsbsplc();
//            jhid = GetUuIdUtils.ReplaceUuId();
//            nkBmysxmsbsplc.setId(jhid);
//            nkBmysxmsbsplc.setFnd(DateConversionUtils.DateToYear(new Date()));
//
//            nbmysxmsbsplcService.save(nkBmysxmsbsplc);
//
//
//            //根据年度查询 部门预算申报
//            List<NkRsBmysxmsb> nkRsBmysxmsblist = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
//                    .eq(NkRsBmysxmsb::getFnd, nd));
//
//            for (NkRsBmysxmsb nkRsBmysxmsblists : nkRsBmysxmsblist) {
//                if (StringUtils.isBlank(nkRsBmysxmsblists.getFjhid())) {
//                    nkRsBmysxmsblists.setFjhid(jhid);
//                    nkyrsBmysxmsbService.updateById(nkRsBmysxmsblists);
//                }
//            }
//        } else {
            jhid = nkBmysxmsbsplcs.get(0).getId();
            List<NkRsBmysxmsb> nkRsBmysxmsblist = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                    .eq(NkRsBmysxmsb::getFnd, nd));
            for (NkRsBmysxmsb nkRsBmysxmsblists : nkRsBmysxmsblist) {
                if (StringUtils.isBlank(nkRsBmysxmsblists.getFjhid())) {
                    nkRsBmysxmsblists.setFjhid(jhid);
                    nkyrsBmysxmsbService.updateById(nkRsBmysxmsblists);
                }
            }
//        }

        List returnbd = new ArrayList();


        //多个
        List hzbd = new ArrayList();
        List ysbd = new ArrayList();
        List esbd = new ArrayList();

        //多个map
        HashMap hzmap = new HashMap();
        HashMap ysmap = new HashMap();

        List<String> flxList = Arrays.asList(flx.split(",|，"));
        if (flxList.size() == 1) {
            if (flx.equals(OaCommonFlowConstant.HZBD_HZ)) {
                List<NkYssbhj> list = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_HZ));


                //将数据集成到到汇总表
                //1.使用计划id 查询部门预算申报表
                List<NkRsBmysxmsb> nkRsBmysxmsbs = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                        .eq(NkRsBmysxmsb::getFjhid, jhid));

                //循环这个list
                for (NkRsBmysxmsb nkRsBmysxmsb : nkRsBmysxmsbs) {
                    //在循环一次获取项目内容
                    List<NkBmysxmsbXmnr> nkBmysxmsbXmnrs = nkBmysxmsbXmnrService.list(new LambdaQueryWrapper<NkBmysxmsbXmnr>()
                            .eq(NkBmysxmsbXmnr::getFbmysxmsbid, nkRsBmysxmsb.getId()));


                    //循环项目内容将数据插入到汇总表
                    for (NkBmysxmsbXmnr nkBmysxmsbXmnr : nkBmysxmsbXmnrs) {
                        if (nkBmysxmsbXmnr.getLx().equals(OaCommonFlowConstant.XMNR_JC)) {

                            List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                                    .eq(NkYssbhj::getFxmnrid, nkBmysxmsbXmnr.getId()));
                            if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                                NkYssbhj nkYssbhj = nkYssbhjs.get(0);
                                nkYssbhj.setFxmmc(nkBmysxmsbXmnr.getJcmc());

                                //差旅
                                nkYssbhj.setFclbzqyszs(nkBmysxmsbXmnr.getJcjzsl());
                                nkYssbhj.setFclbzrs(nkBmysxmsbXmnr.getMjzrs());
                                nkYssbhj.setFclbzts(nkBmysxmsbXmnr.getMjzts());
                                nkYssbhj.setFclbzxj(nkBmysxmsbXmnr.getClfbz());

                                //住宿
                                nkYssbhj.setFzxfts(nkBmysxmsbXmnr.getFszts());
                                nkYssbhj.setFzxfxj(nkBmysxmsbXmnr.getZxfbz());

                                //交通
                                nkYssbhj.setFjtfts(nkBmysxmsbXmnr.getFjtts());
                                nkYssbhj.setFjtfxj(nkBmysxmsbXmnr.getJtfbz());

                                //差旅合计
                                nkYssbhj.setFclfhjh(nkBmysxmsbXmnr.getFclfhj());

                                //劳务费
                                nkYssbhj.setFlwfjcts(nkBmysxmsbXmnr.getFlwts());
                                nkYssbhj.setFlwfrc(nkBmysxmsbXmnr.getFlwrc());
                                nkYssbhj.setFlwfxj(nkBmysxmsbXmnr.getLwfbz());
                                nkYssbhj.setFlwfbz("550");
                                nkYssbhj.setFnd(nd);

                                //类型
                                nkYssbhj.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjService.updateById(nkYssbhj);
                            } else {
                                NkYssbhj nkYssbhj = new NkYssbhj();
                                nkYssbhj.setId(GetUuIdUtils.ReplaceUuId());
                                nkYssbhj.setFyssbjhid(jhid);
                                nkYssbhj.setFxmnrid(nkBmysxmsbXmnr.getId());
                                nkYssbhj.setFksy(nkRsBmysxmsb.getFsqks());
                                nkYssbhj.setFkse(Optional.ofNullable(nkBmysxmsbXmnr.getLxs()).orElseGet(() -> ""));
                                nkYssbhj.setFxmmc(nkBmysxmsbXmnr.getJcmc());
                                //差旅
                                nkYssbhj.setFclbzqyszs(nkBmysxmsbXmnr.getJcjzsl());
                                nkYssbhj.setFclbzrs(nkBmysxmsbXmnr.getMjzrs());
                                nkYssbhj.setFclbzts(nkBmysxmsbXmnr.getMjzts());
                                nkYssbhj.setFclbzxj(nkBmysxmsbXmnr.getClfbz());

                                //住宿
                                nkYssbhj.setFzxfts(nkBmysxmsbXmnr.getFszts());
                                nkYssbhj.setFzxfxj(nkBmysxmsbXmnr.getZxfbz());

                                //交通
                                nkYssbhj.setFjtfts(nkBmysxmsbXmnr.getFjtts());
                                nkYssbhj.setFjtfxj(nkBmysxmsbXmnr.getJtfbz());

                                //差旅合计
                                nkYssbhj.setFclfhjh(nkBmysxmsbXmnr.getFclfhj());

                                //劳务费
                                nkYssbhj.setFlwfjcts(nkBmysxmsbXmnr.getFlwts());
                                nkYssbhj.setFlwfrc(nkBmysxmsbXmnr.getFlwrc());
                                nkYssbhj.setFlwfxj(nkBmysxmsbXmnr.getLwfbz());
                                nkYssbhj.setFlwfbz("550");
                                nkYssbhj.setFnd(nd);
                                //类型
                                nkYssbhj.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjService.save(nkYssbhj);
                            }
                        }
                    }
                }
                if (StringUtils.isNotBlank(bm)){
                    returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_HZ, OaCommonFlowConstant.XMNR_JC,bm);
                }else {
                    returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_HZ, OaCommonFlowConstant.XMNR_JC);
                }

            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {

                List<NkYssbhj> nkYssbhjss = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 汇总 查询所有数据
                    List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                            .eq(NkYssbhj::getFyssbjhid, jhid)
                            .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_HZ));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhj> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhj originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhj newItem = new NkYssbhj();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_YS); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                if (StringUtils.isNotBlank(bm)){
                    returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_YS, OaCommonFlowConstant.XMNR_JC,bm);
                }else {
                    returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_YS, OaCommonFlowConstant.XMNR_JC);
                }


            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

                List<NkYssbhj> nkYssbhjss = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                            .eq(NkYssbhj::getFyssbjhid, jhid)
                            .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhj> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhj originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhj newItem = new NkYssbhj();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                if (StringUtils.isNotBlank(bm)){
                    returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_ES, OaCommonFlowConstant.XMNR_JC,bm);
                }else {
                    returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_ES, OaCommonFlowConstant.XMNR_JC);
                }


            }
        } else {
            if (StringUtils.isNotBlank(bm)) {
                for (String flxLists : flxList) {
                    if (flxLists.equals(OaCommonFlowConstant.HZBD_HZ)) {
                        hzbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC, bm);
                    } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
                        ysbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC, bm);
                    } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                        esbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC, bm);
                    }

                }
            }else {
                for (String flxLists : flxList) {
                    if (flxLists.equals(OaCommonFlowConstant.HZBD_HZ)) {
                        hzbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC);
                    } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
                        ysbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC);
                    } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                        esbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_JC);
                    }

                }
            }
            hzmap.put("hzbd", hzbd);
            hzmap.put("ysbd", ysbd);
            hzmap.put("esbd", esbd);

            returnbd.add(hzmap);

        }
        return returnbd;
    }

    public List returnbd(String jhid, String flx, String jclx,String bm) {




        if (jclx.equals(OaCommonFlowConstant.XMNR_JC)) {

            List<NkYssbhj> lists = new ArrayList<>();

            if (StringUtils.isNotBlank(bm)){
                lists = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, flx)
                        .eq(NkYssbhj::getFksy, bm));
            }else {
                lists = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, flx));
            }


            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhj> nkYssbhjss = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据

                    List<NkYssbhj> nkYssbhjs =    nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                            .eq(NkYssbhj::getFyssbjhid, jhid)
                            .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));


                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhj> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhj originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhj newItem = new NkYssbhj();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            //药品注册
            Map ypzcspcykmaplc = new HashMap(); //药品注册临床
            Map ypzcspcykmapyp = new HashMap(); //药品注册药品


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

            List ypzcspcykmaplistlc = new ArrayList(); //药品注册临床
            List ypzcspcykmaplistyp = new ArrayList(); //药品注册药品


            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhj nkYssbhj : lists) {
                //办公室
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhj);
                }
                //人教科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhj);
                }
                //质量管理与科研科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhj);
                }
                //药品注册审评查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                    ypzcspcykmaplistyp.add(nkYssbhj);
                    ypzcspcykmapyp.put("name", "药品");

                    ypzcspcykmapyp.put("list", ypzcspcykmaplistyp);
                }


                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                    ypzcspcykmaplistlc.add(nkYssbhj);
                    ypzcspcykmaplc.put("name", "临床");

                    ypzcspcykmaplc.put("list", ypzcspcykmaplistlc);
                }
                //药品生产查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhj);
                }
                //药品流通查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhj);
                }
                //医疗器械审评查验1科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhj);
                }
                //医疗器械审评查验2科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhj);
                }
                //食品化妆品审评查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhj);
                }


            }
            ypzcspcykmaplist.add(ypzcspcykmapyp);
            ypzcspcykmaplist.add(ypzcspcykmaplc);

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_KT)) {
            List<NkYssbhjKt> lists = new ArrayList<>();
            if (StringUtils.isNotBlank(bm)){
                lists = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, flx)
                        .eq(NkYssbhjKt::getFktfzks, bm));
            }else {
                lists = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, flx));
            }




            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjKt> nkYssbhjss = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjKt> nkYssbhjs = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                            .eq(NkYssbhjKt::getFyssbjhid, jhid)
                            .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjKt> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjKt originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjKt newItem = new NkYssbhjKt();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjKtService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            //药品注册
//            Map ypzcspcykmaplc = new HashMap(); //药品注册临床
//            Map ypzcspcykmapyp = new HashMap(); //药品注册药品


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册




            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjKt nkYssbhjKt : lists) {
                //办公室
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjKt);
                }
                //人教科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjKt);
                }
                //质量管理与科研科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjKt);
                }
                //药品注册审评查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjKt);


//                    ypzcspcykmapyp.put("list",ypzcspcykmaplistyp);
                }


//                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)){
//                    ypzcspcykmaplistlc.add(nkYssbhj);
//                    ypzcspcykmaplc.put("name","临床");
//
//                    ypzcspcykmaplc.put("list",ypzcspcykmaplistlc);
//                }
                //药品生产查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjKt);
                }
                //药品流通查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjKt);
                }
                //医疗器械审评查验1科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjKt);
                }
                //医疗器械审评查验2科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjKt);
                }
                //食品化妆品审评查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjKt);
                }


            }
//            ypzcspcykmaplist.add(ypzcspcykmapyp);
//            ypzcspcykmaplist.add(ypzcspcykmaplc);

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;


        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_YS)) {
            List<NkYssbhjys> lists = new ArrayList<>();
            if (StringUtils.isNotBlank(bm)){
                lists = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, flx)
                        .eq(NkYssbhjys::getFks, bm));
            }else {
                lists = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, flx));
            }




            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjys> nkYssbhjss = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjys> nkYssbhjs = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                            .eq(NkYssbhjys::getFyssbjhid, jhid)
                            .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjys> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjys originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjys newItem = new NkYssbhjys();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjysService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

//            List ypzcspcykmaplistlc = new ArrayList(); //药品注册临床
//            List ypzcspcykmaplistyp = new ArrayList(); //药品注册药品


            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjys nkYssbhjys : lists) {
                //办公室
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjys);
                }
                //人教科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjys);
                }
                //质量管理与科研科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjys);
                }
                //药品注册审评查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjys);


//                    ypzcspcykmapyp.put("list",ypzcspcykmaplistyp);
                }


//                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)){
//                    ypzcspcykmaplistlc.add(nkYssbhj);
//                    ypzcspcykmaplc.put("name","临床");
//
//                    ypzcspcykmaplc.put("list",ypzcspcykmaplistlc);
//                }
                //药品生产查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjys);
                }
                //药品流通查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjys);
                }
                //医疗器械审评查验1科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjys);
                }
                //医疗器械审评查验2科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjys);
                }
                //食品化妆品审评查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjys);
                }

            }

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;

        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_PX)) {
            List<NkYssbhjPx> lists = new ArrayList<>();
            if (StringUtils.isNotBlank(bm)){
                lists = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, flx)
                        .eq(NkYssbhjPx::getFks, bm));
            }else {
                lists = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, flx));
            }



            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjPx> nkYssbhjss = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {
                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjPx> nkYssbhjs = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                            .eq(NkYssbhjPx::getFyssbjhid, jhid)
                            .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjPx> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjPx originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjPx newItem = new NkYssbhjPx();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                                break;
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjpxService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjPx nkYssbhjpx : lists) {
                //办公室
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjpx);
                }
                //人教科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjpx);
                }
                //质量管理与科研科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjpx);
                }
                //药品注册审评查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjpx);
                }

                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjpx);
                }
                //药品流通查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjpx);
                }
                //医疗器械审评查验1科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjpx);
                }
                //医疗器械审评查验2科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjpx);
                }
                //食品化妆品审评查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjpx);
                }

            }

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;

        }



        throw new BusinessException("数据为空");

    }


    public List returnbd(String jhid, String flx, String jclx) {

        if (jclx.equals(OaCommonFlowConstant.XMNR_JC)) {

            List<NkYssbhj> lists = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, jhid)
                    .eq(NkYssbhj::getFlx, flx));

            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhj> nkYssbhjss = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                        .eq(NkYssbhj::getFyssbjhid, jhid)
                        .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                            .eq(NkYssbhj::getFyssbjhid, jhid)
                            .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhj> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhj originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhj newItem = new NkYssbhj();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            //药品注册
            Map ypzcspcykmaplc = new HashMap(); //药品注册临床
            Map ypzcspcykmapyp = new HashMap(); //药品注册药品


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

            List ypzcspcykmaplistlc = new ArrayList(); //药品注册临床
            List ypzcspcykmaplistyp = new ArrayList(); //药品注册药品


            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhj nkYssbhj : lists) {
                //办公室
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhj);
                }
                //人教科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhj);
                }
                //质量管理与科研科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhj);
                }
                //药品注册审评查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                    ypzcspcykmaplistyp.add(nkYssbhj);
                    ypzcspcykmapyp.put("name", "药品");

                    ypzcspcykmapyp.put("list", ypzcspcykmaplistyp);
                }


                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                    ypzcspcykmaplistlc.add(nkYssbhj);
                    ypzcspcykmaplc.put("name", "临床");

                    ypzcspcykmaplc.put("list", ypzcspcykmaplistlc);
                }
                //药品生产查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhj);
                }
                //药品流通查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhj);
                }
                //医疗器械审评查验1科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhj);
                }
                //医疗器械审评查验2科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhj);
                }
                //食品化妆品审评查验科
                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhj);
                }


            }
            ypzcspcykmaplist.add(ypzcspcykmapyp);
            ypzcspcykmaplist.add(ypzcspcykmaplc);

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;
        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_KT)) {

            List<NkYssbhjKt> lists = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                    .eq(NkYssbhjKt::getFyssbjhid, jhid)
                    .eq(NkYssbhjKt::getFlx, flx));

            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjKt> nkYssbhjss = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjKt> nkYssbhjs = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                            .eq(NkYssbhjKt::getFyssbjhid, jhid)
                            .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjKt> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjKt originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjKt newItem = new NkYssbhjKt();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjKtService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            //药品注册
//            Map ypzcspcykmaplc = new HashMap(); //药品注册临床
//            Map ypzcspcykmapyp = new HashMap(); //药品注册药品


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

//            List ypzcspcykmaplistlc = new ArrayList(); //药品注册临床
//            List ypzcspcykmaplistyp = new ArrayList(); //药品注册药品


            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjKt nkYssbhjKt : lists) {
                //办公室
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjKt);
                }
                //人教科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjKt);
                }
                //质量管理与科研科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjKt);
                }
                //药品注册审评查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjKt);


//                    ypzcspcykmapyp.put("list",ypzcspcykmaplistyp);
                }


//                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)){
//                    ypzcspcykmaplistlc.add(nkYssbhj);
//                    ypzcspcykmaplc.put("name","临床");
//
//                    ypzcspcykmaplc.put("list",ypzcspcykmaplistlc);
//                }
                //药品生产查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjKt);
                }
                //药品流通查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjKt);
                }
                //医疗器械审评查验1科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjKt);
                }
                //医疗器械审评查验2科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjKt);
                }
                //食品化妆品审评查验科
                if (nkYssbhjKt.getFktfzks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjKt);
                }


            }
//            ypzcspcykmaplist.add(ypzcspcykmapyp);
//            ypzcspcykmaplist.add(ypzcspcykmaplc);

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;


        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_YS)) {

            List<NkYssbhjys> lists = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                    .eq(NkYssbhjys::getFyssbjhid, jhid)
                    .eq(NkYssbhjys::getFlx, flx));

            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjys> nkYssbhjss = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjys> nkYssbhjs = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                            .eq(NkYssbhjys::getFyssbjhid, jhid)
                            .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjys> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjys originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjys newItem = new NkYssbhjys();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjysService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科


            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

//            List ypzcspcykmaplistlc = new ArrayList(); //药品注册临床
//            List ypzcspcykmaplistyp = new ArrayList(); //药品注册药品


            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjys nkYssbhjys : lists) {
                //办公室
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjys);
                }
                //人教科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjys);
                }
                //质量管理与科研科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjys);
                }
                //药品注册审评查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjys);


//                    ypzcspcykmapyp.put("list",ypzcspcykmaplistyp);
                }


//                if (nkYssbhj.getFksy().equals(OaFlowConstant.KSMC_YPZCSPCYK) && nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)){
//                    ypzcspcykmaplistlc.add(nkYssbhj);
//                    ypzcspcykmaplc.put("name","临床");
//
//                    ypzcspcykmaplc.put("list",ypzcspcykmaplistlc);
//                }
                //药品生产查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjys);
                }
                //药品流通查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjys);
                }
                //医疗器械审评查验1科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjys);
                }
                //医疗器械审评查验2科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjys);
                }
                //食品化妆品审评查验科
                if (nkYssbhjys.getFks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjys);
                }

            }

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;

        }

        if (jclx.equals(OaCommonFlowConstant.XMNR_PX)) {

            List<NkYssbhjPx> lists = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                    .eq(NkYssbhjPx::getFyssbjhid, jhid)
                    .eq(NkYssbhjPx::getFlx, flx));

            if (CollectionUtils.isEmpty(lists) && flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                List<NkYssbhjPx> nkYssbhjss = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {
                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjPx> nkYssbhjs = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                            .eq(NkYssbhjPx::getFyssbjhid, jhid)
                            .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjPx> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjPx originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjPx newItem = new NkYssbhjPx();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                                break;
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjpxService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

            }
            /**
             * 办公室 人教科 质量管理与科研科  药品注册审评查验科 药品生产查验科 药品流通查验科 医疗器械审评查验1科 医疗器械审评查验2科
             * 食品化妆品审评查验科
             */
            //新建多个科室的map
            Map bgsmap = new HashMap(); //办公室
            Map rjkmap = new HashMap(); //人教科
            Map zlglykykmap = new HashMap(); //质量管理与科研科
            Map ypzcspcykmap = new HashMap(); //药品注册审评查验科

            Map ypsccykmap = new HashMap(); //药品生产查验科
            Map ypltcykkmap = new HashMap(); //药品流通查验科
            Map ylqxspcykykmap = new HashMap(); //医疗器械审评查验1科
            Map ylqxspcykekmap = new HashMap(); //医疗器械审评查验2科
            Map sphzpspcykmap = new HashMap(); //食品化妆品审评查验科


            //新建多个科室list
            List bgslist = new ArrayList(); //办公室
            List rjkmaplist = new ArrayList();
            List zlglykykmaplist = new ArrayList();
            List ypzcspcykmaplist = new ArrayList(); //药品注册

            List ypsccykmaplist = new ArrayList();


            List ypltcykkmaplist = new ArrayList();
            List ylqxspcykykmapist = new ArrayList();
            List ylqxspcykekmaplist = new ArrayList();
            List sphzpspcykmaplist = new ArrayList();


            for (NkYssbhjPx nkYssbhjpx : lists) {
                //办公室
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgslist.add(nkYssbhjpx);
                }
                //人教科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmaplist.add(nkYssbhjpx);
                }
                //质量管理与科研科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglykykmaplist.add(nkYssbhjpx);
                }
                //药品注册审评查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcspcykmaplist.add(nkYssbhjpx);
                }

                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccykmaplist.add(nkYssbhjpx);
                }
                //药品流通查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltcykkmaplist.add(nkYssbhjpx);
                }
                //医疗器械审评查验1科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {
                    ylqxspcykykmapist.add(nkYssbhjpx);
                }
                //医疗器械审评查验2科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxspcykekmaplist.add(nkYssbhjpx);
                }
                //食品化妆品审评查验科
                if (nkYssbhjpx.getFks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzpspcykmaplist.add(nkYssbhjpx);
                }

            }

            bgsmap.put("list", bgslist);
            bgsmap.put("name", "办公室");

            rjkmap.put("list", rjkmaplist);
            rjkmap.put("name", "人教科");

            zlglykykmap.put("list", zlglykykmaplist);
            zlglykykmap.put("name", "质量管理与科研科");

            ypzcspcykmap.put("list", ypzcspcykmaplist);
            ypzcspcykmap.put("name", "药品注册审评查验科");

            ypsccykmap.put("list", ypsccykmaplist);
            ypsccykmap.put("name", "药品生产查验科");

            ypltcykkmap.put("list", ypltcykkmaplist);
            ypltcykkmap.put("name", "药品流通审评查验科");

            ylqxspcykykmap.put("list", ylqxspcykykmapist);
            ylqxspcykykmap.put("name", "医疗器械审评查验1科");

            ylqxspcykekmap.put("list", ylqxspcykekmaplist);
            ylqxspcykekmap.put("name", "医疗器械审评查验2科");

            sphzpspcykmap.put("list", sphzpspcykmaplist);
            sphzpspcykmap.put("name", "食品化妆品审评查验科");

            List AllList = new ArrayList<>();

            AllList.add(bgsmap);
            AllList.add(rjkmap);
            AllList.add(zlglykykmap);
            AllList.add(ypzcspcykmap);
            AllList.add(ypsccykmap);
            AllList.add(ypltcykkmap);
            AllList.add(ylqxspcykykmap);
            AllList.add(ylqxspcykekmap);
            AllList.add(sphzpspcykmap);

            return AllList;

        }



        throw new BusinessException("数据为空");

    }


//    public List getYs(String jhid) {
//        //先查询有没有一上的数据，如果有 就先删除
//        List<NkYssbhj> nkYssbhjss = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
//                .eq(NkYssbhj::getFyssbjhid, jhid)
//                .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_YS));
//        if (CollectionUtils.isNotEmpty(nkYssbhjss)) {
//            nkYssbhjService.removeBatchByIds(nkYssbhjss);
//        }
//        //通过计划id 和 汇总 查询所有数据
//        List<NkYssbhj> nkYssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
//                .eq(NkYssbhj::getFyssbjhid, jhid)
//                .eq(NkYssbhj::getFlx, OaCommonFlowConstant.HZBD_HZ));
//        if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
//            List<NkYssbhj> itemsToInsert = new ArrayList<>(nkYssbhjs.size());
//
//            for (NkYssbhj originalItem : nkYssbhjs) {
//                try {
//                    // 使用BeanUtils.copyProperties复制对象
//                    NkYssbhj newItem = new NkYssbhj();
//                    BeanUtils.copyProperties(newItem, originalItem);
//                    newItem.setId(GetUuIdUtils.ReplaceUuId());
//                    // 修改复制对象的flx字段
//                    newItem.setFlx(OaCommonFlowConstant.HZBD_YS); // 将"新状态值"替换为您希望赋予的新值
//
//                    // 添加到待插入列表
//                    itemsToInsert.add(newItem);
//                } catch (Exception e) {
//                    // 处理复制属性时可能发生的异常，如类型转换异常
//                    log.error("复制NkYssbhj对象属性时发生错误", e);
//                    // 中断循环
//                    break;
//                }
//            }
//
//            // 批量插入到数据库
//            boolean batchInsertSuccess = nkYssbhjService.saveBatch(itemsToInsert);
//
//            if (!batchInsertSuccess) {
//                // 处理批量插入失败的情况
//                log.error("批量插入NkYssbhj数据失败");
//            }
//
//        }
//        //然后返回数据
//        List returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_YS, OaCommonFlowConstant.XMNR_JC);
//        return returnbd;
//    }


    /**
     * 编辑一上
     */
    public List editYs(NkYssbhj nkYssbhjs) {
        List allList = new ArrayList<>();
        if (StringUtils.isNotBlank(nkYssbhjs.getId())) {
            NkYssbhj yssbhj = nkYssbhjService.getById(nkYssbhjs.getId());
            //如果不为空，在继续判断
            if (yssbhj != null) {
                //如果不为空，先将字段更新进表内，在查询然后计算
                nkYssbhjService.updateById(nkYssbhjs);
            }
            /**
             * 更新之后在计算，然后在更新
             */
            NkYssbhj yssbhjs = nkYssbhjService.getById(nkYssbhjs.getId());

            //差旅费
            //差旅补助-企业数/组数
            BigDecimal fclbzqyszs = new BigDecimal(yssbhjs.getFclbzqyszs());
            //差旅补助-人数
            BigDecimal fclbzrs = new BigDecimal(yssbhjs.getFclbzrs());
            //差旅补助-天数
            BigDecimal fclbzts = new BigDecimal(yssbhjs.getFclbzts());

            BigDecimal fclbzxj = fclbzqyszs.multiply(fclbzrs).multiply(fclbzts).multiply(new BigDecimal("180"));
            yssbhjs.setFclbzxj(String.valueOf(fclbzxj));

            //住宿费
            //天数
            BigDecimal fzxfts = new BigDecimal(yssbhjs.getFzxfts());
            //小计
            BigDecimal fzxfxj = fclbzqyszs.multiply(fclbzrs).multiply(fzxfts).multiply(new BigDecimal("330"));
            yssbhjs.setFzxfxj(String.valueOf(fzxfxj));

            //交通费
            //天数
            BigDecimal fjtfts = new BigDecimal(yssbhjs.getFjtfts());
            //小计
            BigDecimal fjtfxj = fclbzqyszs.multiply(fclbzrs).multiply(fjtfts).multiply(new BigDecimal("200"));
            yssbhjs.setFjtfxj(String.valueOf(fjtfxj));

            //差旅费合计-行
            BigDecimal fclfhjh = fclbzxj.add(fzxfxj).add(fjtfxj);
            yssbhjs.setFclfhjh(String.valueOf(fclfhjh));

            //劳务费
            BigDecimal flwfjcts = new BigDecimal(yssbhjs.getFlwfjcts());
            BigDecimal flwfrc = new BigDecimal(yssbhjs.getFlwfrc());
            BigDecimal flwfbz = new BigDecimal(yssbhjs.getFlwfbz());
            BigDecimal flwfxj = fclbzqyszs.multiply(flwfjcts).multiply(flwfrc).multiply(flwfbz);
            yssbhjs.setFlwfxj(String.valueOf(flwfxj));
            //更新
            nkYssbhjService.updateById(yssbhjs);


            //然后重新组合
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();


            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkyssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, yssbhj.getFyssbjhid())
                    .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkyssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (nkYssbhj.getFksy()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);

        }
        return allList;
    }

    /**
     * 第一次进入没有编辑的id返回
     *
     * @param nkYssbhjs
     * @return
     */
    public List editYss(NkYssbhj nkYssbhjs) {
        List allList = new ArrayList<>();
        if (StringUtils.isNotBlank(nkYssbhjs.getFyssbjhid())) {

            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();


            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkyssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, nkYssbhjs.getFyssbjhid())
                    .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));


            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkyssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (nkYssbhj.getFksy()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);

        }
        return allList;
    }


    /**
     * 编辑二上
     */
    public List editEs(NkYssbhj nkYssbhjs) {
        List allList = new ArrayList<>();
        if (StringUtils.isNotBlank(nkYssbhjs.getId())) {
            NkYssbhj yssbhj = nkYssbhjService.getById(nkYssbhjs.getId());
            //如果不为空，在继续判断
            if (yssbhj != null) {
                //如果不为空，先将字段更新进表内，在查询然后计算
                nkYssbhjService.updateById(nkYssbhjs);
            }
            /**
             * 更新之后在计算，然后在更新
             */
            NkYssbhj yssbhjs = nkYssbhjService.getById(nkYssbhjs.getId());

            //差旅费
            //差旅补助-企业数/组数
            BigDecimal fclbzqyszs = new BigDecimal(yssbhjs.getFclbzqyszs());
            //差旅补助-人数
            BigDecimal fclbzrs = new BigDecimal(yssbhjs.getFclbzrs());
            //差旅补助-天数
            BigDecimal fclbzts = new BigDecimal(yssbhjs.getFclbzts());

            BigDecimal fclbzxj = fclbzqyszs.multiply(fclbzrs).multiply(fclbzts).multiply(new BigDecimal("180"));
            yssbhjs.setFclbzxj(String.valueOf(fclbzxj));

            //住宿费
            //天数
            BigDecimal fzxfts = new BigDecimal(yssbhjs.getFzxfts());
            //小计
            BigDecimal fzxfxj = fclbzqyszs.multiply(fclbzrs).multiply(fzxfts).multiply(new BigDecimal("330"));
            yssbhjs.setFzxfxj(String.valueOf(fzxfxj));

            //交通费
            //天数
            BigDecimal fjtfts = new BigDecimal(yssbhjs.getFjtfts());
            //小计
            BigDecimal fjtfxj = fclbzqyszs.multiply(fclbzrs).multiply(fjtfts).multiply(new BigDecimal("200"));
            yssbhjs.setFjtfxj(String.valueOf(fjtfxj));

            //差旅费合计-行
            BigDecimal fclfhjh = fclbzxj.add(fzxfxj).add(fjtfxj);
            yssbhjs.setFclfhjh(String.valueOf(fclfhjh));

            //劳务费
            BigDecimal flwfjcts = new BigDecimal(yssbhjs.getFlwfjcts());
            BigDecimal flwfrc = new BigDecimal(yssbhjs.getFlwfrc());
            BigDecimal flwfbz = new BigDecimal(yssbhjs.getFlwfbz());
            BigDecimal flwfxj = fclbzqyszs.multiply(flwfjcts).multiply(flwfrc).multiply(flwfbz);
            yssbhjs.setFlwfxj(String.valueOf(flwfxj));
            //更新
            nkYssbhjService.updateById(yssbhjs);


            //然后重新组合
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();


            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkyssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, yssbhj.getFyssbjhid())
                    .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkyssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (nkYssbhj.getFksy()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);

        }
        return allList;
    }


    /**
     * 第一次进入没有编辑的id返回 二上
     *
     * @param nkYssbhjs
     * @return
     */
    public List editEss(NkYssbhj nkYssbhjs) {
        List allList = new ArrayList<>();
        if (StringUtils.isNotBlank(nkYssbhjs.getFyssbjhid())) {

            //然后重新组合
            //办公室
            Map bgshj = new HashMap<>();
            //人教科
            Map rjkhj = new HashMap<>();
            //质量管理与科研科
            Map zlglykykhj = new HashMap<>();

            //药品注册审评查验科
            //药品
            Map ypzcspcykclfhjyp = new HashMap<>();
            //临床
            Map ypzcspcykclfhjlc = new HashMap<>();

            //药品生产查验科
            Map ypsccykhj = new HashMap<>();
            //药品流通查验科
            Map ypltcykhj = new HashMap<>();
            //医疗器械审评查验1科
            Map ylqxspcykykhj = new HashMap<>();
            //医疗器械审评查验2科
            Map ylqxspcykekhj = new HashMap<>();
            //食品化妆品评审查验科
            Map sphzpspcykhj = new HashMap<>();


            //通过计划id，可以直接拿到预算表本计划的汇总
            List<NkYssbhj> nkyssbhjs = nkYssbhjService.list(new LambdaQueryWrapper<NkYssbhj>()
                    .eq(NkYssbhj::getFyssbjhid, nkYssbhjs.getFyssbjhid())
                    .eq(NkYssbhj::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));

            //各个部门的数据集合
            //办公室
            BigDecimal bgsclf = new BigDecimal(0);
            BigDecimal bgslwf = new BigDecimal(0);
            //企业组/数
            BigDecimal bgsqys = new BigDecimal(0);
            BigDecimal bgsclrs = new BigDecimal(0);
            BigDecimal bgsclts = new BigDecimal(0);
            BigDecimal bgszsts = new BigDecimal(0);
            BigDecimal bgsjtts = new BigDecimal(0);
            BigDecimal bgslwts = new BigDecimal(0);
            BigDecimal bgslwrc = new BigDecimal(0);


            //人教科
            BigDecimal rjkclf = new BigDecimal(0);
            BigDecimal rjklwf = new BigDecimal(0);

            BigDecimal rjkqys = new BigDecimal(0);
            BigDecimal rjkclrs = new BigDecimal(0);
            BigDecimal rjkclts = new BigDecimal(0);
            BigDecimal rjkzsts = new BigDecimal(0);
            BigDecimal rjkjtts = new BigDecimal(0);
            BigDecimal rjklwts = new BigDecimal(0);
            BigDecimal rjklwrc = new BigDecimal(0);


            //质量管理与科研科
            BigDecimal zlglykykclf = new BigDecimal(0);
            BigDecimal zlglykyklwf = new BigDecimal(0);


            BigDecimal zlglykykqys = new BigDecimal(0);
            BigDecimal zlglykykclrs = new BigDecimal(0);
            BigDecimal zlglykykclts = new BigDecimal(0);
            BigDecimal zlglykykzsts = new BigDecimal(0);
            BigDecimal zlglykykjtts = new BigDecimal(0);
            BigDecimal zlglykyklwts = new BigDecimal(0);
            BigDecimal zlglykyklwrc = new BigDecimal(0);


            //药品注册审评查验科
            //药品
            BigDecimal ypzcspcykclfyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwfyp = new BigDecimal(0);

            BigDecimal ypzcspcykqysyp = new BigDecimal(0);
            BigDecimal ypzcspcykclrsyp = new BigDecimal(0);
            BigDecimal ypzcspcykcltsyp = new BigDecimal(0);
            BigDecimal ypzcspcykzstsyp = new BigDecimal(0);
            BigDecimal ypzcspcykjttsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwtsyp = new BigDecimal(0);
            BigDecimal ypzcspcyklwrcyp = new BigDecimal(0);


            //临床
            BigDecimal ypzcspcykclflc = new BigDecimal(0);
            BigDecimal ypzcspcyklwflc = new BigDecimal(0);

            BigDecimal ypzcspcykqyslc = new BigDecimal(0);
            BigDecimal ypzcspcykclrslc = new BigDecimal(0);
            BigDecimal ypzcspcykcltslc = new BigDecimal(0);
            BigDecimal ypzcspcykzstslc = new BigDecimal(0);
            BigDecimal ypzcspcykjttslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwtslc = new BigDecimal(0);
            BigDecimal ypzcspcyklwrclc = new BigDecimal(0);


            //药品生产查验科
            BigDecimal ypsccykclf = new BigDecimal(0);
            BigDecimal ypsccyklwf = new BigDecimal(0);

            BigDecimal ypsccykqys = new BigDecimal(0);
            BigDecimal ypsccykclrs = new BigDecimal(0);
            BigDecimal ypsccykclts = new BigDecimal(0);
            BigDecimal ypsccykzsts = new BigDecimal(0);
            BigDecimal ypsccykjtts = new BigDecimal(0);
            BigDecimal ypsccyklwts = new BigDecimal(0);
            BigDecimal ypsccyklwrc = new BigDecimal(0);

            //药品流通查验科
            BigDecimal ypltcykclf = new BigDecimal(0);
            BigDecimal ypltcyklwf = new BigDecimal(0);

            BigDecimal ypltcykqys = new BigDecimal(0);
            BigDecimal ypltcykclrs = new BigDecimal(0);
            BigDecimal ypltcykclts = new BigDecimal(0);
            BigDecimal ypltcykzsts = new BigDecimal(0);
            BigDecimal ypltcykjtts = new BigDecimal(0);
            BigDecimal ypltcyklwts = new BigDecimal(0);
            BigDecimal ypltcyklwrc = new BigDecimal(0);


            //医疗器械审评查验1科
            BigDecimal ylqxspcykykclf = new BigDecimal(0);
            BigDecimal ylqxspcykyklwf = new BigDecimal(0);

            BigDecimal ylqxspcykykqys = new BigDecimal(0);
            BigDecimal ylqxspcykykclrs = new BigDecimal(0);
            BigDecimal ylqxspcykykclts = new BigDecimal(0);
            BigDecimal ylqxspcykykzsts = new BigDecimal(0);
            BigDecimal ylqxspcykykjtts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwts = new BigDecimal(0);
            BigDecimal ylqxspcykyklwrc = new BigDecimal(0);


            //医疗器械审评查验2科
            BigDecimal ylqxspcykekclf = new BigDecimal(0);
            BigDecimal ylqxspcykeklwf = new BigDecimal(0);

            BigDecimal ylqxspcykekqys = new BigDecimal(0);
            BigDecimal ylqxspcykekclrs = new BigDecimal(0);
            BigDecimal ylqxspcykekclts = new BigDecimal(0);
            BigDecimal ylqxspcykekzsts = new BigDecimal(0);
            BigDecimal ylqxspcykekjtts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwts = new BigDecimal(0);
            BigDecimal ylqxspcykeklwrc = new BigDecimal(0);


            //食品化妆品评审查验科
            BigDecimal sphzpspcykclf = new BigDecimal(0);
            BigDecimal sphzpspcyklwf = new BigDecimal(0);

            BigDecimal sphzpspcykqys = new BigDecimal(0);
            BigDecimal sphzpspcykclrs = new BigDecimal(0);
            BigDecimal sphzpspcykclts = new BigDecimal(0);
            BigDecimal sphzpspcykzsts = new BigDecimal(0);
            BigDecimal sphzpspcykjtts = new BigDecimal(0);
            BigDecimal sphzpspcyklwts = new BigDecimal(0);
            BigDecimal sphzpspcyklwrc = new BigDecimal(0);

            for (NkYssbhj nkYssbhj : nkyssbhjs) {
                BigDecimal fclfhjhValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFclfhjh()).orElse("0"));
                BigDecimal flwfxjValue = new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfxj()).orElse("0"));

                switch (nkYssbhj.getFksy()) {
                    case OaFlowConstant.KSMC_BGS:
                        bgsclf = bgsclf.add(fclfhjhValue);
                        bgslwf = bgslwf.add(flwfxjValue);
                        bgsqys = bgsqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        bgsclrs = bgsclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        bgsclts = bgsclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        bgszsts = bgszsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        bgsjtts = bgsjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        bgslwts = bgslwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        bgslwrc = bgslwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_RJK:
                        rjkclf = rjkclf.add(fclfhjhValue);
                        rjklwf = rjklwf.add(flwfxjValue);
                        rjkqys = rjkqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        rjkclrs = rjkclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        rjkclts = rjkclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        rjkzsts = rjkzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        rjkjtts = rjkjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        rjklwts = rjklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        rjklwrc = rjklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_ZLGLYKYK:
                        zlglykykclf = zlglykykclf.add(fclfhjhValue);
                        zlglykyklwf = zlglykyklwf.add(flwfxjValue);
                        zlglykykqys = zlglykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        zlglykykclrs = zlglykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        zlglykykclts = zlglykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        zlglykykzsts = zlglykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        zlglykykjtts = zlglykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        zlglykyklwts = zlglykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        zlglykyklwrc = zlglykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        break;
                    case OaFlowConstant.KSMC_YPZCSPCYK:
                        if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_YP)) {
                            ypzcspcykclfyp = ypzcspcykclfyp.add(fclfhjhValue);
                            ypzcspcyklwfyp = ypzcspcyklwfyp.add(flwfxjValue);
                            ypzcspcykqysyp = ypzcspcykqysyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrsyp = ypzcspcykclrsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltsyp = ypzcspcykcltsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstsyp = ypzcspcykzstsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttsyp = ypzcspcykjttsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtsyp = ypzcspcyklwtsyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrcyp = ypzcspcyklwrcyp.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        } else if (nkYssbhj.getFkse().equals(OaFlowConstant.YPZC_LC)) {
                            ypzcspcykclflc = ypzcspcykclflc.add(fclfhjhValue);
                            ypzcspcyklwflc = ypzcspcyklwflc.add(flwfxjValue);
                            ypzcspcykqyslc = ypzcspcykqyslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                            ypzcspcykclrslc = ypzcspcykclrslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                            ypzcspcykcltslc = ypzcspcykcltslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                            ypzcspcykzstslc = ypzcspcykzstslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                            ypzcspcykjttslc = ypzcspcykjttslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                            ypzcspcyklwtslc = ypzcspcyklwtslc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                            ypzcspcyklwrclc = ypzcspcyklwrclc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));

                        }
                        break;

                    case OaFlowConstant.KSMC_YPSCCYK:
                        ypsccykclf = ypsccykclf.add(fclfhjhValue);
                        ypsccyklwf = ypsccyklwf.add(flwfxjValue);
                        ypsccykqys = ypsccykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypsccykclrs = ypsccykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypsccykclts = ypsccykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypsccykzsts = ypsccykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypsccykjtts = ypsccykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypsccyklwts = ypsccyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypsccyklwrc = ypsccyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;

                    case OaFlowConstant.KSMC_YPLTCYK:
                        ypltcykclf = ypltcykclf.add(fclfhjhValue);
                        ypltcyklwf = ypltcyklwf.add(flwfxjValue);
                        ypltcykqys = ypltcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ypltcykclrs = ypltcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ypltcykclts = ypltcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ypltcykzsts = ypltcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ypltcykjtts = ypltcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ypltcyklwts = ypltcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ypltcyklwrc = ypltcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_1:
                        ylqxspcykykclf = ylqxspcykykclf.add(fclfhjhValue);
                        ylqxspcykyklwf = ylqxspcykyklwf.add(flwfxjValue);
                        ylqxspcykykqys = ylqxspcykykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykykclrs = ylqxspcykykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykykclts = ylqxspcykykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykykzsts = ylqxspcykykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykykjtts = ylqxspcykykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykyklwts = ylqxspcykyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykyklwrc = ylqxspcykyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_YLQXSPCYK_2:
                        ylqxspcykekclf = ylqxspcykekclf.add(fclfhjhValue);
                        ylqxspcykeklwf = ylqxspcykeklwf.add(flwfxjValue);
                        ylqxspcykekqys = ylqxspcykekqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        ylqxspcykekclrs = ylqxspcykekclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        ylqxspcykekclts = ylqxspcykekclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        ylqxspcykekzsts = ylqxspcykekzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        ylqxspcykekjtts = ylqxspcykekjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        ylqxspcykeklwts = ylqxspcykeklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        ylqxspcykeklwrc = ylqxspcykeklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    case OaFlowConstant.KSMC_SPHZPPSCYK:
                        sphzpspcykclf = sphzpspcykclf.add(fclfhjhValue);
                        sphzpspcyklwf = sphzpspcyklwf.add(flwfxjValue);
                        sphzpspcykqys = sphzpspcykqys.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzqyszs()).orElse("0")));
                        sphzpspcykclrs = sphzpspcykclrs.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzrs()).orElse("0")));
                        sphzpspcykclts = sphzpspcykclts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFclbzts()).orElse("0")));
                        sphzpspcykzsts = sphzpspcykzsts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFzxfts()).orElse("0")));
                        sphzpspcykjtts = sphzpspcykjtts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFjtfts()).orElse("0")));
                        sphzpspcyklwts = sphzpspcyklwts.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfjcts()).orElse("0")));
                        sphzpspcyklwrc = sphzpspcyklwrc.add(new BigDecimal(Optional.ofNullable(nkYssbhj.getFlwfrc()).orElse("0")));
                        break;
                    default:
                        // 处理其他情况或无需处理
                        break;
                }
            }
            bgshj.put("name", "办公室");
            bgshj.put("clf", bgsclf);
            bgshj.put("lwf", bgslwf);
            bgshj.put("qys", bgsqys);
            bgshj.put("clrs", bgsclrs);
            bgshj.put("clts", bgsclts);
            bgshj.put("zsts", bgszsts);
            bgshj.put("jtts", bgsjtts);
            bgshj.put("lwts", bgslwts);
            bgshj.put("lwrc", bgslwrc);


            //人教科
            rjkhj.put("name", "人教科");
            rjkhj.put("clf", rjkclf);
            rjkhj.put("lwf", rjklwf);
            rjkhj.put("qys", rjkqys);
            rjkhj.put("clrs", rjkclrs);
            rjkhj.put("clts", rjkclts);
            rjkhj.put("zsts", rjkzsts);
            rjkhj.put("jtts", rjkjtts);
            rjkhj.put("lwts", rjklwts);
            rjkhj.put("lwrc", rjklwrc);

            //质量管理与科研科
            zlglykykhj.put("name", "质量管理与科研科");
            zlglykykhj.put("clf", zlglykykclf);
            zlglykykhj.put("lwf", zlglykyklwf);
            zlglykykhj.put("qys", zlglykykqys);
            zlglykykhj.put("clrs", zlglykykclrs);
            zlglykykhj.put("clts", zlglykykclts);
            zlglykykhj.put("zsts", zlglykykzsts);
            zlglykykhj.put("jtts", zlglykykjtts);
            zlglykykhj.put("lwts", zlglykyklwts);
            zlglykykhj.put("lwrc", zlglykyklwrc);


            //药品注册审评查验科合计
            HashMap ypzcspcykhj = new HashMap();
            ypzcspcykhj.put("name", "药品注册审评查验科");
            ypzcspcykhj.put("clf", ypzcspcykclfyp.add(ypzcspcykclflc));
            ypzcspcykhj.put("lwf", ypzcspcyklwfyp.add(ypzcspcyklwflc));
            ypzcspcykhj.put("qys", ypzcspcykqysyp.add(ypzcspcykqyslc));
            ypzcspcykhj.put("clrs", ypzcspcykclrsyp.add(ypzcspcykclrslc));
            ypzcspcykhj.put("clts", ypzcspcykcltsyp.add(ypzcspcykcltslc));
            ypzcspcykhj.put("zsts", ypzcspcykzstsyp.add(ypzcspcykzstslc));
            ypzcspcykhj.put("jtts", ypzcspcykjttsyp.add(ypzcspcykjttslc));
            ypzcspcykhj.put("lwts", ypzcspcyklwtsyp.add(ypzcspcyklwtslc));
            ypzcspcykhj.put("lwrc", ypzcspcyklwrcyp.add(ypzcspcyklwrclc));

            List yplist = new ArrayList<>();

            //药品注册审评查验科 药品
            ypzcspcykclfhjyp.put("name", "药品");
            ypzcspcykclfhjyp.put("clf", ypzcspcykclfyp);
            ypzcspcykclfhjyp.put("lwf", ypzcspcyklwfyp);
            ypzcspcykclfhjyp.put("qys", ypzcspcykqysyp);
            ypzcspcykclfhjyp.put("clrs", ypzcspcykclrsyp);
            ypzcspcykclfhjyp.put("clts", ypzcspcykcltsyp);
            ypzcspcykclfhjyp.put("zsts", ypzcspcykzstsyp);
            ypzcspcykclfhjyp.put("jtts", ypzcspcykjttsyp);
            ypzcspcykclfhjyp.put("lwts", ypzcspcyklwtsyp);
            ypzcspcykclfhjyp.put("lwrc", ypzcspcyklwrcyp);

            //药品注册审评查验科 临床
            ypzcspcykclfhjlc.put("name", "临床");
            ypzcspcykclfhjlc.put("clf", ypzcspcykclflc);
            ypzcspcykclfhjlc.put("lwf", ypzcspcyklwflc);
            ypzcspcykclfhjlc.put("qys", ypzcspcykqyslc);
            ypzcspcykclfhjlc.put("clrs", ypzcspcykclrslc);
            ypzcspcykclfhjlc.put("clts", ypzcspcykcltslc);
            ypzcspcykclfhjlc.put("zsts", ypzcspcykzstslc);
            ypzcspcykclfhjlc.put("jtts", ypzcspcykjttslc);
            ypzcspcykclfhjlc.put("lwts", ypzcspcyklwtslc);
            ypzcspcykclfhjlc.put("lwrc", ypzcspcyklwrclc);


            yplist.add(ypzcspcykclfhjyp);
            yplist.add(ypzcspcykclfhjlc);


            ypzcspcykhj.put("list", yplist);


            //药品生产查验科
            ypsccykhj.put("name", "药品生产查验科");
            ypsccykhj.put("clf", ypsccykclf);
            ypsccykhj.put("lwf", ypsccyklwf);
            ypsccykhj.put("qys", ypsccykqys);
            ypsccykhj.put("clrs", ypsccykclrs);
            ypsccykhj.put("clts", ypsccykclts);
            ypsccykhj.put("zsts", ypsccykzsts);
            ypsccykhj.put("jtts", ypsccykjtts);
            ypsccykhj.put("lwts", ypsccyklwts);
            ypsccykhj.put("lwrc", ypsccyklwrc);
            //药品流通查验科
            ypltcykhj.put("name", "药品流通查验科");
            ypltcykhj.put("clf", ypltcykclf);
            ypltcykhj.put("lwf", ypltcyklwf);
            ypltcykhj.put("qys", ypltcykqys);
            ypltcykhj.put("clrs", ypltcykclrs);
            ypltcykhj.put("clts", ypltcykclts);
            ypltcykhj.put("zsts", ypltcykzsts);
            ypltcykhj.put("jtts", ypltcykjtts);
            ypltcykhj.put("lwts", ypltcyklwts);
            ypltcykhj.put("lwrc", ypltcyklwrc);
            //医疗器械审评查验1科
            ylqxspcykykhj.put("name", "医疗器械审评查验1科");
            ylqxspcykykhj.put("clf", ylqxspcykykclf);
            ylqxspcykykhj.put("lwf", ylqxspcykyklwf);
            ylqxspcykykhj.put("qys", ylqxspcykykqys);
            ylqxspcykykhj.put("clrs", ylqxspcykykclrs);
            ylqxspcykykhj.put("clts", ylqxspcykykclts);
            ylqxspcykykhj.put("zsts", ylqxspcykykzsts);
            ylqxspcykykhj.put("jtts", ylqxspcykykjtts);
            ylqxspcykykhj.put("lwts", ylqxspcykyklwts);
            ylqxspcykykhj.put("lwrc", ylqxspcykyklwrc);
            //医疗器械审评查验2科
            ylqxspcykekhj.put("name", "医疗器械审评查验2科");
            ylqxspcykekhj.put("clf", ylqxspcykekclf);
            ylqxspcykekhj.put("lwf", ylqxspcykeklwf);
            ylqxspcykekhj.put("qys", ylqxspcykekqys);
            ylqxspcykekhj.put("clrs", ylqxspcykekclrs);
            ylqxspcykekhj.put("clts", ylqxspcykekclts);
            ylqxspcykekhj.put("zsts", ylqxspcykekzsts);
            ylqxspcykekhj.put("jtts", ylqxspcykekjtts);
            ylqxspcykekhj.put("lwts", ylqxspcykeklwts);
            ylqxspcykekhj.put("lwrc", ylqxspcykeklwrc);
            //食品化妆品评审查验科
            sphzpspcykhj.put("name", "食品化妆品评审查验科");
            sphzpspcykhj.put("clf", sphzpspcykclf);
            sphzpspcykhj.put("lwf", sphzpspcyklwf);
            sphzpspcykhj.put("qys", sphzpspcykqys);
            sphzpspcykhj.put("clrs", sphzpspcykclrs);
            sphzpspcykhj.put("clts", sphzpspcykclts);
            sphzpspcykhj.put("zsts", sphzpspcykzsts);
            sphzpspcykhj.put("jtts", sphzpspcykjtts);
            sphzpspcykhj.put("lwts", sphzpspcyklwts);
            sphzpspcykhj.put("lwrc", sphzpspcyklwrc);

            //总计
            HashMap zjmap = new HashMap();
            zjmap.put("name", "总计");
            zjmap.put("clf", bgsclf.add(rjkclf).add(zlglykykclf).add(ypzcspcykclfyp).add(ypzcspcykclflc)
                    .add(ypsccykclf).add(ypltcykclf).add(ylqxspcykykclf).add(ylqxspcykekclf).add(sphzpspcykclf));
            zjmap.put("lwf", bgslwf.add(rjklwf).add(zlglykyklwf).add(ypzcspcyklwfyp).add(ypzcspcyklwflc)
                    .add(ypsccyklwf).add(ypltcyklwf).add(ylqxspcykyklwf).add(ylqxspcykeklwf).add(sphzpspcyklwf));
            zjmap.put("qys", bgsqys.add(rjkqys).add(zlglykykqys).add(ypzcspcykqysyp).add(ypzcspcykqyslc)
                    .add(ypsccykqys).add(ypltcykqys).add(ylqxspcykykqys).add(ylqxspcykekqys).add(sphzpspcykqys));
            zjmap.put("clrs", bgsclrs.add(rjkclrs).add(zlglykykclrs).add(ypzcspcykclrsyp).add(ypzcspcykclrslc)
                    .add(ypsccykclrs).add(ypltcykclrs).add(ylqxspcykykclrs).add(ylqxspcykekclrs).add(sphzpspcykclrs));
            zjmap.put("clts", bgsclts.add(rjkclts).add(zlglykykclts).add(ypzcspcykcltsyp).add(ypzcspcykcltslc)
                    .add(ypsccykclts).add(ypltcykclts).add(ylqxspcykykclts).add(ylqxspcykekclts).add(sphzpspcykclts));
            zjmap.put("zsts", bgszsts.add(rjkzsts).add(zlglykykzsts).add(ypzcspcykzstsyp).add(ypzcspcykzstslc)
                    .add(ypsccykzsts).add(ypltcykzsts).add(ylqxspcykykzsts).add(ylqxspcykekzsts).add(sphzpspcykzsts));
            zjmap.put("jtts", bgsjtts.add(rjkjtts).add(zlglykykjtts).add(ypzcspcykjttsyp).add(ypzcspcykjttslc)
                    .add(ypsccykjtts).add(ypltcykjtts).add(ylqxspcykykjtts).add(ylqxspcykekjtts).add(sphzpspcykjtts));
            zjmap.put("lwts", bgslwts.add(rjklwts).add(zlglykyklwts).add(ypzcspcyklwtsyp).add(ypzcspcyklwtslc)
                    .add(ypsccyklwts).add(ypltcyklwts).add(ylqxspcykyklwts).add(ylqxspcykeklwts).add(sphzpspcyklwts));
            zjmap.put("lwrc", bgslwrc.add(rjklwrc).add(zlglykyklwrc).add(ypzcspcyklwrcyp).add(ypzcspcyklwrclc)
                    .add(ypsccyklwrc).add(ypltcyklwrc).add(ylqxspcykyklwrc).add(ylqxspcykeklwrc).add(sphzpspcyklwrc));


            allList.add(bgshj);
            allList.add(rjkhj);
            allList.add(zlglykykhj);

            allList.add(ypzcspcykhj);
            allList.add(ypsccykhj);
            allList.add(ypltcykhj);
            allList.add(ylqxspcykykhj);
            allList.add(ylqxspcykekhj);
            allList.add(sphzpspcykhj);
            allList.add(zjmap);


        }
        return allList;
    }


    public List getBmyssblc(String jhid) {
        String fhjmc = "";
        String fsfwc = "";

        HashMap<String, String> bgsmap = new HashMap<>();
        HashMap<String, String> rjkmap = new HashMap<>();
        HashMap<String, String> zlglkykmap = new HashMap<>();
        HashMap<String, String> ypzcscmap = new HashMap<>();
        HashMap<String, String> ypsccymap = new HashMap<>();
        HashMap<String, String> ypltmap = new HashMap<>();
        HashMap<String, String> ylqxykmap = new HashMap<>();
        HashMap<String, String> ylqxekmap = new HashMap<>();
        HashMap<String, String> sphzppmap = new HashMap<>();

        List<NkRsBmysxmsb> rsBmysxmsbs = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                .eq(NkRsBmysxmsb::getFjhid, jhid));

        if (CollectionUtils.isNotEmpty(rsBmysxmsbs)) {
            for (NkRsBmysxmsb rsBmysxmsb : rsBmysxmsbs) {
                String id = rsBmysxmsb.getId();
                //获取部门预算申报的id，在待办表中查询，如果没有就直接返回第一个环节，如果有在job表中更新
                List<OaProcessBusiness> businessList = oaProcessBusinessService.list(new LambdaQueryWrapper<OaProcessBusiness>()
                        .eq(OaProcessBusiness::getFpid, id));
                if (CollectionUtils.isNotEmpty(businessList)) {
                    //查看当前为待办的数据
                    List<OaJobEntity> jobEntities = oaSpcySqsxJobService.list(new LambdaQueryWrapper<OaJobEntity>()
                            .eq(OaJobEntity::getFpid, id)
                            .eq(OaJobEntity::getFblzt, OaFlowConstant.FLOW_BLZT_DB));
                    //不为空有待办 ，为空代表已经走完了
                    if (CollectionUtils.isNotEmpty(jobEntities)) {
                        fhjmc = jobEntities.get(0).getFhjmc();
                        fsfwc = OaCommonFlowConstant.FLOW_LCZB;
                    } else {
                        fhjmc = OaFlowConstant.YSSBLC_BM_FGLDSH;
                        fsfwc = OaCommonFlowConstant.FLOW_LCJS;
                    }

                } else {
                    //如果为空，那就代表没有发起流程在第一步
                    fhjmc = OaFlowConstant.YSSBLC_BM_SQ;
                    fsfwc = OaCommonFlowConstant.FLOW_LCZB;
                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_BGS)) {
                    bgsmap.put("name", OaFlowConstant.KSMC_BGS);
                    bgsmap.put("hjmc", fhjmc);
                    bgsmap.put("lczt", fsfwc);
                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_RJK)) {
                    rjkmap.put("name", OaFlowConstant.KSMC_RJK);
                    rjkmap.put("hjmc", fhjmc);
                    rjkmap.put("lczt", fsfwc);
                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_ZLGLYKYK)) {
                    zlglkykmap.put("name", OaFlowConstant.KSMC_ZLGLYKYK);
                    zlglkykmap.put("hjmc", fhjmc);
                    zlglkykmap.put("lczt", fsfwc);
                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_YPZCSPCYK)) {
                    ypzcscmap.put("name", OaFlowConstant.KSMC_YPZCSPCYK);
                    ypzcscmap.put("hjmc", fhjmc);
                    ypzcscmap.put("lczt", fsfwc);

                }
                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_YPSCCYK)) {
                    ypsccymap.put("name", OaFlowConstant.KSMC_YPSCCYK);
                    ypsccymap.put("hjmc", fhjmc);
                    ypsccymap.put("lczt", fsfwc);
                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_YPLTCYK)) {
                    ypltmap.put("name", OaFlowConstant.KSMC_YPLTCYK);
                    ypltmap.put("hjmc", fhjmc);
                    ypltmap.put("lczt", fsfwc);

                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_YLQXSPCYK_1)) {

                    ylqxykmap.put("name", OaFlowConstant.KSMC_YLQXSPCYK_1);
                    ylqxykmap.put("hjmc", fhjmc);
                    ylqxykmap.put("lczt", fsfwc);


                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_YLQXSPCYK_2)) {
                    ylqxekmap.put("name", OaFlowConstant.KSMC_YLQXSPCYK_2);
                    ylqxekmap.put("hjmc", fhjmc);
                    ylqxekmap.put("lczt", fsfwc);

                }

                if (rsBmysxmsb.getFsqks().equals(OaFlowConstant.KSMC_SPHZPPSCYK)) {
                    sphzppmap.put("name", OaFlowConstant.KSMC_SPHZPPSCYK);
                    sphzppmap.put("hjmc", fhjmc);
                    sphzppmap.put("lczt", fsfwc);

                }
            }
        }
        List allList = new ArrayList<>();
        if (!bgsmap.isEmpty()) {
            allList.add(bgsmap);
        }
        if (!rjkmap.isEmpty()) {
            allList.add(rjkmap);
        }
        if (!zlglkykmap.isEmpty()) {
            allList.add(zlglkykmap);
        }
        if (!ypzcscmap.isEmpty()) {
            allList.add(ypzcscmap);
        }
        if (!ypsccymap.isEmpty()) {
            allList.add(ypsccymap);
        }
        if (!ypltmap.isEmpty()) {
            allList.add(ypltmap);
        }
        if (!ylqxykmap.isEmpty()) {
            allList.add(ylqxykmap);
        }

        if (!ylqxekmap.isEmpty()) {
            allList.add(ylqxekmap);
        }
        if (!sphzppmap.isEmpty()) {
            allList.add(sphzppmap);
        }


        return allList;
    }


    /**
     * 汇总表单课题
     */
    public List getyssbkt(String flx,String bm) {

        List<NkRsnd> nkRsnds = nkRsNdService.list(new LambdaQueryWrapper<NkRsnd>()
                .eq(NkRsnd::getFsfxz, OaCommonFlowConstant.NDXZ_YES));

        int ndi = Integer.valueOf(nkRsnds.get(0).getFnd()) + 1;
        //如果本年度的计划为空，新建计划.然后更新

        String nd = String.valueOf(ndi);
        String jhid = "";
        List<NkBmysxmsbsplc> nkBmysxmsbsplcs = nbmysxmsbsplcService.list(new LambdaQueryWrapper<NkBmysxmsbsplc>()
                .eq(NkBmysxmsbsplc::getFnd, nd));
        if (CollectionUtils.isEmpty(nkBmysxmsbsplcs)) {
            //先新建一个计划，然后根据年度将部门预算申报计划的计划id字段赋值
            NkBmysxmsbsplc nkBmysxmsbsplc = new NkBmysxmsbsplc();
            jhid = GetUuIdUtils.ReplaceUuId();
            nkBmysxmsbsplc.setId(jhid);
            nkBmysxmsbsplc.setFnd(DateConversionUtils.DateToYear(new Date()));
            nbmysxmsbsplcService.save(nkBmysxmsbsplc);
        }else {
            jhid = nkBmysxmsbsplcs.get(0).getId();
        }

        List returnbd = new ArrayList();


        //多个
        List hzbd = new ArrayList();
        List ysbd = new ArrayList();
        List esbd = new ArrayList();

        //多个map
        HashMap hzmap = new HashMap();
        HashMap ysmap = new HashMap();

        List<String> flxList = Arrays.asList(flx.split(",|，"));
        if (flxList.size() == 1) {
            if (flx.equals(OaCommonFlowConstant.HZBD_HZ)) {
                List<NkYssbhjKt> list = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, OaCommonFlowConstant.HZBD_HZ));


                //将数据集成到到汇总表
                //1.使用计划id 查询部门预算申报表
                List<NkRsBmysxmsb> nkRsBmysxmsbs = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                        .eq(NkRsBmysxmsb::getFjhid, jhid));

                //循环这个list
                for (NkRsBmysxmsb nkRsBmysxmsb : nkRsBmysxmsbs) {
                    //在循环一次获取项目内容
                    List<NkBmysxmsbXmnr> nkBmysxmsbXmnrs = nkBmysxmsbXmnrService.list(new LambdaQueryWrapper<NkBmysxmsbXmnr>()
                            .eq(NkBmysxmsbXmnr::getFbmysxmsbid, nkRsBmysxmsb.getId()));


                    //循环项目内容将数据插入到汇总表
                    for (NkBmysxmsbXmnr nkBmysxmsbXmnr : nkBmysxmsbXmnrs) {
                        if (nkBmysxmsbXmnr.getLx().equals(OaCommonFlowConstant.XMNR_KT)) {

                            List<NkYssbhjKt> nkYssbhjskt = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                                    .eq(NkYssbhjKt::getFxmnrid, nkBmysxmsbXmnr.getId())
                                    .eq(NkYssbhjKt::getFlx, OaCommonFlowConstant.HZBD_HZ));

                            if (CollectionUtils.isNotEmpty(nkYssbhjskt)) {
                                NkYssbhjKt nkYssbhjkt = nkYssbhjskt.get(0);
                                nkYssbhjkt.setFktmc(nkBmysxmsbXmnr.getFktmc());

                                nkYssbhjkt.setFktjf(nkBmysxmsbXmnr.getFktjf());
                                nkYssbhjkt.setFktfzks(nkBmysxmsbXmnr.getFktfzks());
                                nkYssbhjkt.setFktfzr(nkBmysxmsbXmnr.getFktfzr());
                                nkYssbhjkt.setFktwtdw(nkBmysxmsbXmnr.getFzfdxjglx());

                                //类型
                                nkYssbhjkt.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjKtService.updateById(nkYssbhjkt);
                            } else {
                                NkYssbhjKt nkYssbhjKt = new NkYssbhjKt();
                                nkYssbhjKt.setId(GetUuIdUtils.ReplaceUuId());
                                nkYssbhjKt.setFyssbjhid(jhid);
                                nkYssbhjKt.setFxmnrid(nkBmysxmsbXmnr.getId());
                                nkYssbhjKt.setFktmc(nkBmysxmsbXmnr.getFktmc());


                                nkYssbhjKt.setFktjf(nkBmysxmsbXmnr.getFktjf());
                                nkYssbhjKt.setFktfzks(nkBmysxmsbXmnr.getFktfzks());
                                nkYssbhjKt.setFktfzr(nkBmysxmsbXmnr.getFktfzr());
                                nkYssbhjKt.setFktwtdw(nkBmysxmsbXmnr.getFzfdxjglx());

                                //类型
                                nkYssbhjKt.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjKtService.save(nkYssbhjKt);
                            }
                        }
                    }
                }

                returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_HZ, OaCommonFlowConstant.XMNR_KT,bm);
            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {

                List<NkYssbhjKt> nkYssbhjss = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 汇总 查询所有数据
                    List<NkYssbhjKt> nkYssbhjs = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                            .eq(NkYssbhjKt::getFyssbjhid, jhid)
                            .eq(NkYssbhjKt::getFlx, OaCommonFlowConstant.HZBD_HZ));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjKt> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjKt originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjKt newItem = new NkYssbhjKt();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_YS); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjKtService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_YS, OaCommonFlowConstant.XMNR_KT,bm);

            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

                List<NkYssbhjKt> nkYssbhjss = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                        .eq(NkYssbhjKt::getFyssbjhid, jhid)
                        .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjKt> nkYssbhjs = nkYssbhjKtService.list(new LambdaQueryWrapper<NkYssbhjKt>()
                            .eq(NkYssbhjKt::getFyssbjhid, jhid)
                            .eq(NkYssbhjKt::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjKt> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjKt originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjKt newItem = new NkYssbhjKt();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjKtService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_ES, OaCommonFlowConstant.XMNR_KT,bm);

            }
        } else {

            for (String flxLists : flxList) {
                if (flxLists.equals(OaCommonFlowConstant.HZBD_HZ)) {
                    hzbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_KT,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
                    ysbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_KT,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                    esbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_KT,bm);
                }

            }
            hzmap.put("hzbd", hzbd);
            hzmap.put("ysbd", ysbd);
            hzmap.put("esbd", esbd);

            returnbd.add(hzmap);

        }
        return returnbd;


    }


    /**
     * 汇总表单 印刷
     *
     * @param
     * @param flx
     * @return
     */
    public List getyssbys( String flx,String bm) {




        List<NkRsnd> nkRsnds = nkRsNdService.list(new LambdaQueryWrapper<NkRsnd>()
                .eq(NkRsnd::getFsfxz, OaCommonFlowConstant.NDXZ_YES));

        int ndi = Integer.valueOf(nkRsnds.get(0).getFnd()) + 1;
        //如果本年度的计划为空，新建计划.然后更新

        String nd = String.valueOf(ndi);


        String jhid = "";
        List<NkBmysxmsbsplc> nkBmysxmsbsplcs = nbmysxmsbsplcService.list(new LambdaQueryWrapper<NkBmysxmsbsplc>()
                .eq(NkBmysxmsbsplc::getFnd, nd));
        if (CollectionUtils.isEmpty(nkBmysxmsbsplcs)) {
            //先新建一个计划，然后根据年度将部门预算申报计划的计划id字段赋值
            NkBmysxmsbsplc nkBmysxmsbsplc = new NkBmysxmsbsplc();
            jhid = GetUuIdUtils.ReplaceUuId();
            nkBmysxmsbsplc.setId(jhid);
            nkBmysxmsbsplc.setFnd(DateConversionUtils.DateToYear(new Date()));
            nbmysxmsbsplcService.save(nkBmysxmsbsplc);

        }else {
            jhid = nkBmysxmsbsplcs.get(0).getId();
        }

        List returnbd = new ArrayList();


        //多个
        List hzbd = new ArrayList();
        List ysbd = new ArrayList();
        List esbd = new ArrayList();

        //多个map
        HashMap hzmap = new HashMap();
        HashMap ysmap = new HashMap();

        List<String> flxList = Arrays.asList(flx.split(",|，"));
        if (flxList.size() == 1) {
            if (flx.equals(OaCommonFlowConstant.HZBD_HZ)) {
                List<NkYssbhjys> list = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, OaCommonFlowConstant.HZBD_HZ));


                //将数据集成到到汇总表
                //1.使用计划id 查询部门预算申报表
                List<NkRsBmysxmsb> nkRsBmysxmsbs = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                        .eq(NkRsBmysxmsb::getFjhid, jhid));

                //循环这个list
                for (NkRsBmysxmsb nkRsBmysxmsb : nkRsBmysxmsbs) {
                    //在循环一次获取项目内容
                    List<NkBmysxmsbXmnr> nkBmysxmsbXmnrs = nkBmysxmsbXmnrService.list(new LambdaQueryWrapper<NkBmysxmsbXmnr>()
                            .eq(NkBmysxmsbXmnr::getFbmysxmsbid, nkRsBmysxmsb.getId()));


                    //循环项目内容将数据插入到汇总表
                    for (NkBmysxmsbXmnr nkBmysxmsbXmnr : nkBmysxmsbXmnrs) {
                        if (nkBmysxmsbXmnr.getLx().equals(OaCommonFlowConstant.XMNR_YS)) {

                            List<NkYssbhjys> nkYssbhjsys = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                                    .eq(NkYssbhjys::getFxmnrid, nkBmysxmsbXmnr.getId())
                                    .eq(NkYssbhjys::getFlx, OaCommonFlowConstant.HZBD_HZ));
                            if (CollectionUtils.isNotEmpty(nkYssbhjsys)) {
                                NkYssbhjys nkYssbhjys = nkYssbhjsys.get(0);
                                nkYssbhjys.setFsbmc(nkBmysxmsbXmnr.getFsbmc());

                                nkYssbhjys.setFsbsl(nkBmysxmsbXmnr.getFsbsl());
                                nkYssbhjys.setFmbqs(nkBmysxmsbXmnr.getFmbqs());
                                nkYssbhjys.setFyzhj(nkBmysxmsbXmnr.getFyzhj());
                                nkYssbhjys.setFks(nkyrsBmysxmsbService.getById(nkBmysxmsbXmnr.getFbmysxmsbid()).getFsqks());

                                //类型
                                nkYssbhjys.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjysService.updateById(nkYssbhjys);
                            } else {
                                NkYssbhjys nkYssbhjys = new NkYssbhjys();
                                nkYssbhjys.setId(GetUuIdUtils.ReplaceUuId());
                                nkYssbhjys.setFyssbjhid(jhid);
                                nkYssbhjys.setFxmnrid(nkBmysxmsbXmnr.getId());
                                nkYssbhjys.setFsbmc(nkBmysxmsbXmnr.getFsbmc());

                                nkYssbhjys.setFsbsl(nkBmysxmsbXmnr.getFsbsl());
                                nkYssbhjys.setFmbqs(nkBmysxmsbXmnr.getFmbqs());
                                nkYssbhjys.setFyzhj(nkBmysxmsbXmnr.getFyzhj());
                                nkYssbhjys.setFks(nkyrsBmysxmsbService.getById(nkBmysxmsbXmnr.getFbmysxmsbid()).getFsqks());

                                //类型
                                nkYssbhjys.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjysService.save(nkYssbhjys);
                            }
                        }
                    }
                }

                returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_HZ, OaCommonFlowConstant.XMNR_YS,bm);
            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {

                List<NkYssbhjys> nkYssbhjss = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 汇总 查询所有数据
                    List<NkYssbhjys> nkYssbhjs = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                            .eq(NkYssbhjys::getFyssbjhid, jhid)
                            .eq(NkYssbhjys::getFlx, OaCommonFlowConstant.HZBD_HZ));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjys> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjys originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjys newItem = new NkYssbhjys();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_YS); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjysService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_YS, OaCommonFlowConstant.XMNR_YS,bm);

            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

                List<NkYssbhjys> nkYssbhjss = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                        .eq(NkYssbhjys::getFyssbjhid, jhid)
                        .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjys> nkYssbhjs = nkYssbhjysService.list(new LambdaQueryWrapper<NkYssbhjys>()
                            .eq(NkYssbhjys::getFyssbjhid, jhid)
                            .eq(NkYssbhjys::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhjs)) {
                        List<NkYssbhjys> itemsToInsert = new ArrayList<>(nkYssbhjs.size());

                        for (NkYssbhjys originalItem : nkYssbhjs) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjys newItem = new NkYssbhjys();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjysService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_ES, OaCommonFlowConstant.XMNR_YS,bm);

            }
        } else {

            for (String flxLists : flxList) {
                if (flxLists.equals(OaCommonFlowConstant.HZBD_HZ)) {
                    hzbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_YS,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
                    ysbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_YS,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                    esbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_YS,bm);
                }

            }
            hzmap.put("hzbd", hzbd);
            hzmap.put("ysbd", ysbd);
            hzmap.put("esbd", esbd);

            returnbd.add(hzmap);

        }
        return returnbd;


    }


    /**
     * 汇总 培训
     */
    public List getyssbpx( String flx,String bm) {

        //如果本年度的计划为空，新建计划.然后更新



        List<NkRsnd> nkRsnds = nkRsNdService.list(new LambdaQueryWrapper<NkRsnd>()
                .eq(NkRsnd::getFsfxz, OaCommonFlowConstant.NDXZ_YES));

        int ndi = Integer.valueOf(nkRsnds.get(0).getFnd()) + 1;
        //如果本年度的计划为空，新建计划.然后更新

        String nd = String.valueOf(ndi);

        String jhid = "";
        List<NkBmysxmsbsplc> nkBmysxmsbsplcs = nbmysxmsbsplcService.list(new LambdaQueryWrapper<NkBmysxmsbsplc>()
                .eq(NkBmysxmsbsplc::getFnd, nd));
        if (CollectionUtils.isEmpty(nkBmysxmsbsplcs)) {
            //先新建一个计划，然后根据年度将部门预算申报计划的计划id字段赋值
            NkBmysxmsbsplc nkBmysxmsbsplc = new NkBmysxmsbsplc();
            jhid = GetUuIdUtils.ReplaceUuId();
            nkBmysxmsbsplc.setId(jhid);
            nkBmysxmsbsplc.setFnd(DateConversionUtils.DateToYear(new Date()));

            nbmysxmsbsplcService.save(nkBmysxmsbsplc);

        }else {
            jhid = nkBmysxmsbsplcs.get(0).getId();
        }

        List returnbd = new ArrayList();


        //多个
        List hzbd = new ArrayList();
        List ysbd = new ArrayList();
        List esbd = new ArrayList();

        //多个map
        HashMap hzmap = new HashMap();
        HashMap ysmap = new HashMap();

        List<String> flxList = Arrays.asList(flx.split(",|，"));
        if (flxList.size() == 1) {
            if (flx.equals(OaCommonFlowConstant.HZBD_HZ)) {
                List<NkYssbhjPx> list = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, OaCommonFlowConstant.HZBD_HZ));


                //将数据集成到到汇总表
                //1.使用计划id 查询部门预算申报表
                List<NkRsBmysxmsb> nkRsBmysxmsbs = nkyrsBmysxmsbService.list(new LambdaQueryWrapper<NkRsBmysxmsb>()
                        .eq(NkRsBmysxmsb::getFjhid, jhid));

                //循环这个list
                for (NkRsBmysxmsb nkRsBmysxmsb : nkRsBmysxmsbs) {
                    //在循环一次获取项目内容
                    List<NkBmysxmsbXmnr> nkBmysxmsbXmnrs = nkBmysxmsbXmnrService.list(new LambdaQueryWrapper<NkBmysxmsbXmnr>()
                            .eq(NkBmysxmsbXmnr::getFbmysxmsbid, nkRsBmysxmsb.getId()));


                    //循环项目内容将数据插入到汇总表
                    for (NkBmysxmsbXmnr nkBmysxmsbXmnr : nkBmysxmsbXmnrs) {
                        if (nkBmysxmsbXmnr.getLx().equals(OaCommonFlowConstant.XMNR_PX)) {

                            List<NkYssbhjPx> nkYssbhjspx = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                                    .eq(NkYssbhjPx::getFxmnrid, nkBmysxmsbXmnr.getId())
                                    .eq(NkYssbhjPx::getFlx, OaCommonFlowConstant.HZBD_HZ));
                            if (CollectionUtils.isNotEmpty(nkYssbhjspx)) {
                                NkYssbhjPx nkYssbhjpx = nkYssbhjspx.get(0);
                                nkYssbhjpx.setFpxmc(nkBmysxmsbXmnr.getFpxmc());

                                nkYssbhjpx.setFpxrs(nkBmysxmsbXmnr.getFpxrs());
                                nkYssbhjpx.setFpxts(nkBmysxmsbXmnr.getFpxts());
                                nkYssbhjpx.setFbz(nkBmysxmsbXmnr.getFbz());
                                nkYssbhjpx.setFpxfy(nkBmysxmsbXmnr.getFpxfy());
                                nkYssbhjpx.setFskf(nkBmysxmsbXmnr.getFskf());
                                nkYssbhjpx.setFxst(nkBmysxmsbXmnr.getFxst());
                                nkYssbhjpx.setFzgxs(nkBmysxmsbXmnr.getFzgxs());
                                nkYssbhjpx.setFzgfy(nkBmysxmsbXmnr.getFzgfy());
                                nkYssbhjpx.setFfgxs(nkBmysxmsbXmnr.getFfgxs());
                                nkYssbhjpx.setFfgfy(nkBmysxmsbXmnr.getFfgfy());
                                nkYssbhjpx.setFpxskxj(nkBmysxmsbXmnr.getFpxskxj());
                                nkYssbhjpx.setFpxnr(nkBmysxmsbXmnr.getFpxnr());
                                nkYssbhjpx.setFpxdx(nkBmysxmsbXmnr.getFpxdx());
                                nkYssbhjpx.setFpxdd(nkBmysxmsbXmnr.getFpxdd());
                                nkYssbhjpx.setFks(nkyrsBmysxmsbService.getById(nkBmysxmsbXmnr.getFbmysxmsbid()).getFsqks());

                                nkYssbhjpx.setFpxbz(nkBmysxmsbXmnr.getFpxbz());


                                //类型
                                nkYssbhjpx.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjpxService.updateById(nkYssbhjpx);
                            } else {
                                NkYssbhjPx nkYssbhjpx = new NkYssbhjPx();
                                nkYssbhjpx.setId(GetUuIdUtils.ReplaceUuId());
                                nkYssbhjpx.setFyssbjhid(jhid);
                                nkYssbhjpx.setFxmnrid(nkBmysxmsbXmnr.getId());

                                nkYssbhjpx.setFpxmc(nkBmysxmsbXmnr.getFpxmc());

                                nkYssbhjpx.setFpxrs(nkBmysxmsbXmnr.getFpxrs());
                                nkYssbhjpx.setFpxts(nkBmysxmsbXmnr.getFpxts());
                                nkYssbhjpx.setFbz(nkBmysxmsbXmnr.getFbz());
                                nkYssbhjpx.setFpxfy(nkBmysxmsbXmnr.getFpxfy());
                                nkYssbhjpx.setFskf(nkBmysxmsbXmnr.getFskf());
                                nkYssbhjpx.setFxst(nkBmysxmsbXmnr.getFxst());
                                nkYssbhjpx.setFzgxs(nkBmysxmsbXmnr.getFzgxs());
                                nkYssbhjpx.setFzgfy(nkBmysxmsbXmnr.getFzgfy());
                                nkYssbhjpx.setFfgxs(nkBmysxmsbXmnr.getFfgxs());
                                nkYssbhjpx.setFfgfy(nkBmysxmsbXmnr.getFfgfy());
                                nkYssbhjpx.setFpxskxj(nkBmysxmsbXmnr.getFpxskxj());
                                nkYssbhjpx.setFpxnr(nkBmysxmsbXmnr.getFpxnr());
                                nkYssbhjpx.setFpxdx(nkBmysxmsbXmnr.getFpxdx());
                                nkYssbhjpx.setFpxdd(nkBmysxmsbXmnr.getFpxdd());
                                nkYssbhjpx.setFks(nkyrsBmysxmsbService.getById(nkBmysxmsbXmnr.getFbmysxmsbid()).getFsqks());

                                nkYssbhjpx.setFpxbz(nkBmysxmsbXmnr.getFpxbz());


                                //类型
                                nkYssbhjpx.setFlx(OaCommonFlowConstant.HZBD_HZ);

                                nkYssbhjpxService.save(nkYssbhjpx);
                            }
                        }
                    }
                }

                returnbd = this.returnbd(jhid, OaCommonFlowConstant.HZBD_HZ, OaCommonFlowConstant.XMNR_PX,bm);
            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {

                List<NkYssbhjPx> nkYssbhjss = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                if (CollectionUtils.isEmpty(nkYssbhjss)) {


                    //通过计划id 和 汇总 查询所有数据
                    List<NkYssbhjPx> nkYssbhpx = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                            .eq(NkYssbhjPx::getFyssbjhid, jhid)
                            .eq(NkYssbhjPx::getFlx, OaCommonFlowConstant.HZBD_HZ));
                    //如果汇总不为空
                    if (CollectionUtils.isNotEmpty(nkYssbhpx)) {
                        List<NkYssbhjPx> itemsToInsert = new ArrayList<>(nkYssbhpx.size());

                        for (NkYssbhjPx originalItem : nkYssbhpx) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjPx newItem = new NkYssbhjPx();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_YS); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjpxService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_YS, OaCommonFlowConstant.XMNR_PX,bm);

            }


            if (flx.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {

                List<NkYssbhjPx> nkYssbhjPxes = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                        .eq(NkYssbhjPx::getFyssbjhid, jhid)
                        .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_ES));
                if (CollectionUtils.isEmpty(nkYssbhjPxes)) {


                    //通过计划id 和 一上 查询所有数据
                    List<NkYssbhjPx> nkYssbhpx = nkYssbhjpxService.list(new LambdaQueryWrapper<NkYssbhjPx>()
                            .eq(NkYssbhjPx::getFyssbjhid, jhid)
                            .eq(NkYssbhjPx::getFlx, OaFlowConstant.YSSBLC_CWSH_YS));
                    if (CollectionUtils.isNotEmpty(nkYssbhpx)) {
                        List<NkYssbhjPx> itemsToInsert = new ArrayList<>(nkYssbhpx.size());

                        for (NkYssbhjPx originalItem : nkYssbhpx) {
                            try {
                                // 使用BeanUtils.copyProperties复制对象
                                NkYssbhjPx newItem = new NkYssbhjPx();
                                BeanUtils.copyProperties(newItem, originalItem);
                                newItem.setId(GetUuIdUtils.ReplaceUuId());
                                // 修改复制对象的flx字段
                                newItem.setFlx(OaFlowConstant.YSSBLC_CWSH_ES); // 将"新状态值"替换为新值

                                // 添加到待插入列表
                                itemsToInsert.add(newItem);
                            } catch (Exception e) {
                                // 处理复制属性时可能发生的异常，如类型转换异常
                                log.error("复制NkYssbhj对象属性时发生错误", e);
                                // 可能需要进一步处理，比如记录错误日志、中断循环等
                            }
                        }

                        // 批量插入到数据库
                        boolean batchInsertSuccess = nkYssbhjpxService.saveBatch(itemsToInsert);

                        if (!batchInsertSuccess) {
                            // 处理批量插入失败的情况
                            log.error("批量插入NkYssbhj数据失败");
                        }

                    }
                }

                //然后返回数据
                returnbd = this.returnbd(jhid, OaFlowConstant.YSSBLC_CWSH_ES, OaCommonFlowConstant.XMNR_PX,bm);

            }
        } else {

            for (String flxLists : flxList) {
                if (flxLists.equals(OaCommonFlowConstant.HZBD_HZ)) {
                    hzbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_PX,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_YS)) {
                    ysbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_PX,bm);
                } else if (flxLists.equals(OaFlowConstant.YSSBLC_CWSH_ES)) {
                    esbd = this.returnbd(jhid, flxLists, OaCommonFlowConstant.XMNR_PX,bm);
                }

            }
            hzmap.put("hzbd", hzbd);
            hzmap.put("ysbd", ysbd);
            hzmap.put("esbd", esbd);

            returnbd.add(hzmap);

        }
        return returnbd;


    }



    public List hzjxzbss(String jhid,String flx){

        List<String> deptList = CollectionUtil.newArrayList(
                OaFlowConstant.KSMC_BGS,
                OaFlowConstant.KSMC_RJK,
                OaFlowConstant.KSMC_ZLGLYKYK,
                OaFlowConstant.KSMC_YPZCSPCYK,
                OaFlowConstant.KSMC_YPSCCYK,
                OaFlowConstant.KSMC_YPLTCYK,
                OaFlowConstant.KSMC_YLQXSPCYK_1,
                OaFlowConstant.KSMC_YLQXSPCYK_2,
                OaFlowConstant.KSMC_SPHZPPSCYK
        );

        List<String> jxzbmcMlList = CollectionUtil.newArrayList(
                OaFlowConstant.JXSB_LWF,
                OaFlowConstant.JXSB_CLF,
                OaFlowConstant.JXSB_PXF,
                OaFlowConstant.JXSB_YXF,
                OaFlowConstant.JXSB_KTF
        );

        List<String> lxMlList = CollectionUtil.newArrayList(
                "产出指标",
                "效益指标",
                "满意度指标"
        );

        List<String> lxmcDataMl1List = CollectionUtil.newArrayList(
                "数量指标",
                "质量指标",
                "时效指标",
                "成本指标"
        );

        List<String> lxmcDataMl2List = CollectionUtil.newArrayList(
                "社会效益指标",
                "可持续影响指标"
        );

        List<String> lxmcDataMl3List = CollectionUtil.newArrayList(
                "服务对象满意度指标"
        );

        Map lxmcDataMap = new HashMap();
        lxmcDataMap.put("产出指标", lxmcDataMl1List);
        lxmcDataMap.put("效益指标", lxmcDataMl2List);
        lxmcDataMap.put("满意度指标", lxmcDataMl3List);

        List<Map> resultMap = new ArrayList<>(deptList.size());

        List<NkYssbhjjxzb> zbOrgDataList = nkYssbhjjxzbService.list(new LambdaQueryWrapper<NkYssbhjjxzb>()
                .eq(NkYssbhjjxzb::getFjhid, jhid)
                .eq(NkYssbhjjxzb::getFlx, flx));


        /**
         * 查询产出指标的数据
         */

        int total = 0;
        int jxzbmcSize = 0;
        int lxmcSize = 0;
        int slzbSize = 0;

        int topIndex = -1;
        int topDataIndex = -1;

        int index = -1;
        int dataIndex = 0;

        for (String ksmc : deptList){
            Map ksmcMap = new HashMap();
            List<Map> jxzbmcList = new ArrayList<>();

            List<NkYssbhjjxzb> ksZbDataList = zbOrgDataList.stream()
                    .filter(f ->
                            f.getFks().equals(ksmc)
                    )
                    .collect(Collectors.toList());

            total = 0;
            topIndex = -1;
            topDataIndex = 0;

            for (String jxzbmc : jxzbmcMlList){
                Map jxzbmcMap = new HashMap();
                List<Map> lxList = new ArrayList<>();

                jxzbmcSize = 0;
                index = -1;

                dataIndex = 0;
                for (String lxmc : lxMlList){
                    Map lxmcMap = new HashMap();
                    List<Map> lxmcDataList = new ArrayList<>();

                    List<String> slzbList = (List<String>) lxmcDataMap.get(lxmc);

                    List<NkYssbhjjxzb> zlzbDataList = ksZbDataList.stream()
                            .filter(f ->
                                    f.getFjxsblx().equals(jxzbmc) && f.getFyjzblx().equals(lxmc)
                            )
                            .collect(Collectors.toList());

                    lxmcSize = 0;
                    slzbSize = 0;

                    for (String slzb : slzbList){
                        Map slzbMap = new HashMap();
                        List<Map> zbDataList = new ArrayList<>();

                        List<NkYssbhjjxzb> keyValueList = zlzbDataList.stream()
                                .filter(f ->
                                        f.getFejzblx().equals(slzb)
                                )
                                .collect(Collectors.toList());

                        for (NkYssbhjjxzb data : keyValueList){
                            Map slzbDataMap = new HashMap();
                            String key = "";
                            String value = "";

                            key = Optional.ofNullable(data.getFsjzb()).orElse("");
                            value = Optional.ofNullable(data.getFzbz()).orElse("");
                            slzbDataMap.put("id",data.getId());
                            slzbDataMap.put("key", key);
                            slzbDataMap.put("value", value);
                            zbDataList.add(slzbDataMap);
                        }

                        slzbMap.put("slzb", slzb);
                        slzbMap.put("zbDataList", zbDataList);
                        slzbSize = zbDataList.size();
                        slzbMap.put("size", slzbSize);

                        lxmcSize += slzbSize;
                        lxmcDataList.add(slzbMap);
                    }

                    if (index == -1 && lxmcSize > 0){
                        index = dataIndex;
                    }
                    dataIndex++;
                    lxmcMap.put("lxmc", lxmc);
                    lxmcMap.put("lxmcDataList", lxmcDataList);
                    lxmcMap.put("size", lxmcSize);

                    jxzbmcSize += lxmcSize;
                    lxList.add(lxmcMap);
                }

                jxzbmcMap.put("fjssblx", jxzbmc);
                jxzbmcMap.put("lxList", lxList);
                jxzbmcMap.put("size", jxzbmcSize);
                jxzbmcMap.put("index", index);
                total += jxzbmcSize;
                jxzbmcList.add(jxzbmcMap);

                if (topIndex == -1 && jxzbmcSize > 0){
                    topIndex = topDataIndex;
                }
                topDataIndex++;
            }

            ksmcMap.put("ksmc", ksmc);
            ksmcMap.put("jxzbmcList", jxzbmcList);
            ksmcMap.put("size", total);
            ksmcMap.put("index", topIndex);

            resultMap.add(ksmcMap);
        }

        return resultMap;
    }
    public List hzjxzbss(String jhid,String bm,String flx){

        List<String> deptList = CollectionUtil.newArrayList(
                bm
        );

        List<String> jxzbmcMlList = CollectionUtil.newArrayList(
                OaFlowConstant.JXSB_LWF,
                OaFlowConstant.JXSB_CLF,
                OaFlowConstant.JXSB_PXF,
                OaFlowConstant.JXSB_YXF,
                OaFlowConstant.JXSB_KTF
        );

        List<String> lxMlList = CollectionUtil.newArrayList(
                "产出指标",
                "效益指标",
                "满意度指标"
        );

        List<String> lxmcDataMl1List = CollectionUtil.newArrayList(
                "数量指标",
                "质量指标",
                "时效指标",
                "成本指标"
        );

        List<String> lxmcDataMl2List = CollectionUtil.newArrayList(
                "社会效益指标",
                "可持续影响指标"
        );

        List<String> lxmcDataMl3List = CollectionUtil.newArrayList(
                "服务对象满意度指标"
        );

        Map lxmcDataMap = new HashMap();
        lxmcDataMap.put("产出指标", lxmcDataMl1List);
        lxmcDataMap.put("效益指标", lxmcDataMl2List);
        lxmcDataMap.put("满意度指标", lxmcDataMl3List);

        List<Map> resultMap = new ArrayList<>(deptList.size());

        List<NkYssbhjjxzb> zbOrgDataList = nkYssbhjjxzbService.list(new LambdaQueryWrapper<NkYssbhjjxzb>()
                .eq(NkYssbhjjxzb::getFjhid, jhid)
                .eq(NkYssbhjjxzb::getFlx, flx));


        /**
         * 查询产出指标的数据
         */

        int total = 0;
        int jxzbmcSize = 0;
        int lxmcSize = 0;
        int slzbSize = 0;

        int topIndex = -1;
        int topDataIndex = -1;

        int index = -1;
        int dataIndex = 0;

        for (String ksmc : deptList){
            Map ksmcMap = new HashMap();
            List<Map> jxzbmcList = new ArrayList<>();

            List<NkYssbhjjxzb> ksZbDataList = zbOrgDataList.stream()
                    .filter(f ->
                            f.getFks().equals(ksmc)
                    )
                    .collect(Collectors.toList());

            total = 0;
            topIndex = -1;
            topDataIndex = 0;

            for (String jxzbmc : jxzbmcMlList){
                Map jxzbmcMap = new HashMap();
                List<Map> lxList = new ArrayList<>();

                jxzbmcSize = 0;
                index = -1;

                dataIndex = 0;
                for (String lxmc : lxMlList){
                    Map lxmcMap = new HashMap();
                    List<Map> lxmcDataList = new ArrayList<>();

                    List<String> slzbList = (List<String>) lxmcDataMap.get(lxmc);

                    List<NkYssbhjjxzb> zlzbDataList = ksZbDataList.stream()
                            .filter(f ->
                                    f.getFjxsblx().equals(jxzbmc) && f.getFyjzblx().equals(lxmc)
                            )
                            .collect(Collectors.toList());

                    lxmcSize = 0;
                    slzbSize = 0;

                    for (String slzb : slzbList){
                        Map slzbMap = new HashMap();
                        List<Map> zbDataList = new ArrayList<>();

                        List<NkYssbhjjxzb> keyValueList = zlzbDataList.stream()
                                .filter(f ->
                                        f.getFejzblx().equals(slzb)
                                )
                                .collect(Collectors.toList());

                        for (NkYssbhjjxzb data : keyValueList){
                            Map slzbDataMap = new HashMap();
                            String key = "";
                            String value = "";

                            key = Optional.ofNullable(data.getFsjzb()).orElse("");
                            value = Optional.ofNullable(data.getFzbz()).orElse("");
                            slzbDataMap.put("id",data.getId());
                            slzbDataMap.put("key", key);
                            slzbDataMap.put("value", value);
                            zbDataList.add(slzbDataMap);
                        }

                        slzbMap.put("slzb", slzb);
                        slzbMap.put("zbDataList", zbDataList);
                        slzbSize = zbDataList.size();
                        slzbMap.put("size", slzbSize);

                        lxmcSize += slzbSize;
                        lxmcDataList.add(slzbMap);
                    }

                    if (index == -1 && lxmcSize > 0){
                        index = dataIndex;
                    }
                    dataIndex++;
                    lxmcMap.put("lxmc", lxmc);
                    lxmcMap.put("lxmcDataList", lxmcDataList);
                    lxmcMap.put("size", lxmcSize);

                    jxzbmcSize += lxmcSize;
                    lxList.add(lxmcMap);
                }

                jxzbmcMap.put("fjssblx", jxzbmc);
                jxzbmcMap.put("lxList", lxList);
                jxzbmcMap.put("size", jxzbmcSize);
                jxzbmcMap.put("index", index);
                total += jxzbmcSize;
                jxzbmcList.add(jxzbmcMap);

                if (topIndex == -1 && jxzbmcSize > 0){
                    topIndex = topDataIndex;
                }
                topDataIndex++;
            }

            ksmcMap.put("ksmc", ksmc);
            ksmcMap.put("jxzbmcList", jxzbmcList);
            ksmcMap.put("size", total);
            ksmcMap.put("index", topIndex);
            resultMap.add(ksmcMap);
        }

        return resultMap;
    }
}
